/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_affectationbesoin")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvAffectationbesoin.findAll", query = "SELECT c FROM CvAffectationbesoin c"),
    @NamedQuery(name = "CvAffectationbesoin.findByDateaffectation", query = "SELECT c FROM CvAffectationbesoin c WHERE c.dateaffectation = :dateaffectation"),
    @NamedQuery(name = "CvAffectationbesoin.findByStatue", query = "SELECT c FROM CvAffectationbesoin c WHERE c.statue = :statue"),
    @NamedQuery(name = "CvAffectationbesoin.findById", query = "SELECT c FROM CvAffectationbesoin c WHERE c.id = :id"),
    @NamedQuery(name = "CvAffectationbesoin.findByPositionDebutJourn", query = "SELECT c FROM CvAffectationbesoin c WHERE c.positionDebutJourn = :positionDebutJourn"),
    @NamedQuery(name = "CvAffectationbesoin.findByHeurDeDepart", query = "SELECT c FROM CvAffectationbesoin c WHERE c.heurDeDepart = :heurDeDepart")})
public class CvAffectationbesoin implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idAffectation", fetch = FetchType.EAGER)
    private List<CvCheikeuraffectationbesoin> cvCheikeuraffectationbesoinList;
    private static final long serialVersionUID = 1L;
    @Column(name = "dateaffectation")
    private Integer dateaffectation;
    @Column(name = "statue")
    private Short statue;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "positionDebutJourn")
    private String positionDebutJourn;
    @Column(name = "HeurDeDepart")
    @Temporal(TemporalType.TIME)
    private Date heurDeDepart;
    @JoinColumn(name = "cv_listebesoin_idbesoin", referencedColumnName = "idbesoin")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private CvListebesoin cvListebesoinIdbesoin;
    @JoinColumn(name = "idvehicule", referencedColumnName = "idvehicule")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private CvVehicule idvehicule;
    @JoinColumn(name = "idchauffeur", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private CvTravailleur idchauffeur;

    public CvAffectationbesoin() {
    }

    public CvAffectationbesoin(Integer id) {
        this.id = id;
    }

    public Integer getDateaffectation() {
        return dateaffectation;
    }

    public void setDateaffectation(Integer dateaffectation) {
        this.dateaffectation = dateaffectation;
    }

    public Short getStatue() {
        return statue;
    }

    public void setStatue(Short statue) {
        this.statue = statue;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPositionDebutJourn() {
        return positionDebutJourn;
    }

    public void setPositionDebutJourn(String positionDebutJourn) {
        this.positionDebutJourn = positionDebutJourn;
    }

    public Date getHeurDeDepart() {
        return heurDeDepart;
    }

    public void setHeurDeDepart(Date heurDeDepart) {
        this.heurDeDepart = heurDeDepart;
    }

    public CvListebesoin getCvListebesoinIdbesoin() {
        return cvListebesoinIdbesoin;
    }

    public void setCvListebesoinIdbesoin(CvListebesoin cvListebesoinIdbesoin) {
        this.cvListebesoinIdbesoin = cvListebesoinIdbesoin;
    }

    public CvVehicule getIdvehicule() {
        return idvehicule;
    }

    public void setIdvehicule(CvVehicule idvehicule) {
        this.idvehicule = idvehicule;
    }

    public CvTravailleur getIdchauffeur() {
        return idchauffeur;
    }

    public void setIdchauffeur(CvTravailleur idchauffeur) {
        this.idchauffeur = idchauffeur;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvAffectationbesoin)) {
            return false;
        }
        CvAffectationbesoin other = (CvAffectationbesoin) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvAffectationbesoin[ id=" + id + " ]";
    }

    @XmlTransient
    @JsonIgnore
    public List<CvCheikeuraffectationbesoin> getCvCheikeuraffectationbesoinList() {
        return cvCheikeuraffectationbesoinList;
    }

    public void setCvCheikeuraffectationbesoinList(List<CvCheikeuraffectationbesoin> cvCheikeuraffectationbesoinList) {
        this.cvCheikeuraffectationbesoinList = cvCheikeuraffectationbesoinList;
    }
    
}
